package com.nowcoder.code.lcof;

public class JZ48 {
    public static void main(String[] args) {
        System.out.println(new JZ48().lengthOfLongestSubstring("bbbbb"));

    }


    public int lengthOfLongestSubstring(String s) {
        char[] cs = s.toCharArray();

        int max = 1;
        int nowmax = 1;
        int start = 0;
        for (int i = 1; i < cs.length; i++) {
            for (int j = start; j < i; j++) {
                if (cs[i] == cs[j]) {
                    start = j + 1;
                    nowmax = i - start;
                }
            }
            nowmax++;
            max = Math.max(nowmax, max);
        }

        return max;

    }


}
